﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediPlatform.Domain.Order
{
    /// <summary>
    /// 处方表
    /// </summary>
    public class Prescription
    {

        /// <summary>
        /// 主键，自增
        /// </summary>
        [Key]
        public long? Id { get; set; }

        /// <summary>
        /// 唯一电子处方编号
        /// </summary>
        [StringLength(64)]
        public string? PrescriptionNo { get; set; }

        /// <summary>
        /// 患者ID
        /// </summary>
        public long? PatientId { get; set; }

        /// <summary>
        /// 医生ID
        /// </summary>
        public long? DoctorId { get; set; }

        /// <summary>
        /// 就诊医院ID
        /// </summary>
        public long? HospitalId { get; set; }

        /// <summary>
        /// 科室ID
        /// </summary>
        public long? DepartmentId { get; set; }

        /// <summary>
        /// 诊断结果
        /// </summary>
        public string? Diagnosis { get; set; }

        /// <summary>
        /// 处方状态：1-有效, 2-已使用, 3-已过期, 4-已作废
        /// </summary>
        public int? Status { get; set; } = 1; // 默认有效

        /// <summary>
        /// 有效期截止时间
        /// </summary>
        public DateTime? ValidUntil { get; set; }

        /// <summary>
        /// 医生电子签名（或签名ID）
        /// </summary>
        public string? Signature { get; set; }

        /// <summary>
        /// 加密存储：包含药品列表、用法用量等核心信息
        /// </summary>
        public string? EncryptedData { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedAt { get; set; } = DateTime.Now;
    }
}
